package main

import "time"

/**
当 goroutine 发生 panic时，只会调用触发panic这个goroutine中的延迟函数，然后再输出panic信息
*/
func main() {
	defer println("in main")
	go func() {
		defer println("in goroutine")
		panic("goroutine panic")
	}()
	time.Sleep(4 * time.Second)
}

/**
output:
in goroutine
panic: goroutine panic

goroutine 17 [running]:
main.main.func1()
        /root/code/go/basic/eggo/panic/demo03/main.go:9 +0x49
created by main.main
        /root/code/go/basic/eggo/panic/demo03/main.go:7 +0x45
exit status 2
*/
